// JavaScript Document

//fade
$("img:visible").imagesLoaded({
	progress: function (isBroken, $images, $proper, $broken) {
		$(this).fadeTo("medium", 1);
	},
	always: function() {
		$("img").css("opacity", 1);
	}
});

//inputs
$("select, input, a.button, button").uniform();
$("label").inFieldLabels();

//top menu
$("#top_menu > li").on({
	mouseenter: function() {
		if(!$("#doc:focus").length) $(this).children("div.dropdown").stop().hide().slideDown();
	},
	mouseleave: function() {
		if(!$("#doc:focus").length) $(this).children("div.dropdown").stop().attr("style", "");
	}
});

//links
$("#section").on("click", "div.article", function() {
	var rel = $(this).find("a").attr("rel");
	if(!!rel) $("#video iframe").attr("src", rel);
});

//scrollable
$("div.scrollable").scrollable();